%%%%%%%%%%%%%%
% Summarize beta estimates


industry=0;
beta_full=zeros(1,4);
importers=0;
exporters=0;

for w=1:50

folder=sprintf('../china/estimation/serial_correlation/raw/no_sc/raw%d',w)


cd (folder)

load imp.raw;
load data2_q.mat
load beta.mat;

M=length(imp);

beta_full=[beta_full; beta_p_sol beta_x_sol beta_c_sol xi_tilde_sol];
importers=[importers; M];
exporters=[exporters; X];
end

beta_full=beta_full(2:end,:);
importers=importers(2:end,:);
exporters=exporters(2:end,:);


summary=[importers exporters];



b1=mean(beta_full)
b2=median(beta_full)
b3=sqrt(var(beta_full))

beta_summary=[b1; b2; b3];
cd ../china/estimation/serial_correlation
%save('beta_summary','beta_summary')
%dlmwrite('beta_summary.txt',beta_summary)